<?php
namespace Home\Common;

class ChargeLog extends Mysql{
	
	//充值记录by渠道
	function getLogByChannel(){
		$date	=	session('mog_thedate');
		
		$result	=	$this->mysql->prepare("select channelid,count(distinct(userid)),count(*),sum(sum) from mog_charge 
				where thedate = '$date' group by channelid");
		$result->execute();
		
		$arResult	=	array();
		while($row	=	$result->fetch(\PDO::FETCH_ASSOC)){
			array_push($arResult,array($row['channelid'],$row['count(distinct(userid))'],$row['count(*)'],$row['sum(sum)']));
		}
		
		return $arResult;
	}
	
	
	//充值记录by区服
	function getLogByServer(){
		$date	=	session('mog_thedate');
		
		$result	=	$this->mysql->prepare("select serverid,count(distinct(userid)),count(*),SUM(sum) from mog_charge 
				where thedate = '$date' group by serverid");
		$result->execute();
		
		$arResult	=	array();
		while($row	=	$result->fetch(\PDO::FETCH_ASSOC)){
			array_push($arResult,array($row['serverid'],$row['count(distinct(userid))'],$row['count(*)'],$row['SUM(sum)']));
		}
		
		return $arResult;
	}
}
?>